home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Pure virtual destructors?
- Date: 16 Apr 1996 23:38:26 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4l1b1i$7c3@news1.h1.usa.pipeline.com>
- References: <4kuq0i$p6t@ftp.ee.vill.edu>
- NNTP-Posting-Host: 38.8.120.13
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Apr 16, 1996 00:35:30 in article <Pure virtual destructors?>,
- 'sheridan@monet.vill.edu' wrote:
-
-
- >
- >The rule with destructors is that they are always overridden, right?
-
- No. In fact, you may substitute 'never' for 'always'.
-
- >That's a quote from VC4 docs, BTW. When I do this:
- >
- >class CBase {
- >public:
- >virtual ~CBase() = 0;
- >...};
- >
- >class CChild : public CBase {
- >public:
- >~CChild();
- >...};
- >
- >and declare a body for ~CChild, I always get unresolved external on
- >CBase::~CBase. I have seen this in several cases. My guess is it's not
- >a compiler bug, so what am I missing?
- >
- >Thanks.
- >Pete Sheridan
- >
- Destructors are a special breed of functions in that they are
- called for all inherited classes whether or not you have
- defined a destructor for a derived class. They are never
- inherited. Of course, the preceding assumes that the objects
- in question are being properly destructed.
-
- Since all base class destructors are being called, you can't
- have a pure virtual destructor without a body.
-
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-